'\" t
.\"     Title: \fBmysqlserverclone\fR
.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\"      Date: 01/14/2017
.\"    Manual: MySQL Utilities
.\"    Source: MySQL 1.6.4
.\"  Language: English
.\"
.TH "\FBMYSQLSERVERCLONE\" "1" "01/14/2017" "MySQL 1\&.6\&.4" "MySQL Utilities"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
mysqlserverclone \- Clone Existing Server to Create New Server
.SH "SYNOPSIS"
.HP \w'\fBmysqlserverclone\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u
\fBmysqlserverclone [\fR\fB\fIoptions\fR\fR\fB]\fR
.SH "DESCRIPTION"
.PP
This utility enables you to clone an existing MySQL server instance to create a new server instance on the same host\&. The utility creates a new datadir (\fB\-\-new\-data\fR), and, on Unix systems, starts the server with a socket file\&. You can optionally add a password for the login user account on the new instance\&.
.PP
If the user does not have read and write access to the folder specified by the
\fB\-\-new\-data\fR
option, the utility issues an error\&.
.PP
Similarly, if the folder specified by
\fB \-\-new\-data\fR
exists and is not empty, the utility does not delete the folder and issues an error message\&. Users must specify the
\fB\-\-delete\-data\fR
option to permit the utility to remove the folder prior to starting the cloned server\&.
.PP
The utility does not copy any data\&. It merely creates a new running instance of the cloned server with the same options (or additional options if specified)\&. Thus, to create a copy of a server, you must copy the data after the server is cloned\&.
OPTIONS.PP
\fBmysqlserverclone\fR
accepts the following command\-line options:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-help
.sp
Display a help message and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-license
.sp
Display license information and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-delete\-data
.sp
Delete the folder specified by
\fB\-\-new\-data\fR
if it exists and is not empty\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-basedir
.sp
The base directory for the MySQL server source, as an alternative to the
\fB\-\-server\fR
option\&.
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlserverclone\fR \fB\-\-basedir=/source/mysql\-5\&.6 \e\fR
\fB\-\-new\-data=/source/temp_3007 \-\-new\-port=3007 \-\-new\-id=101 \e\fR
\fB\-\-root=root \-\-mysqld="\-\-log\-bin \-\-gtid\-mode=on \-\-log\-slave\-updates \e\fR
\fB\-\-enforce\-gtid\-consistency \-\-master\-info\-repository=table \e\fR
\fB\-\-report\-host=localhost \-\-report\-port=3007" \-\-delete\fR
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-force
.sp
Ignore the maximum path length and the low space checks for the
\fB\-\-new\-data\fR
option\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-mysqld=\fIoptions\fR
.sp
Additional options for
\fBmysqld\fR\&. To specify multiple options, separate them by spaces\&. Use appropriate quoting as necessary\&. For example, to specify
\-\-log\-bin=binlog
and
\-\-general\-log\-file="mylogfile", use:
.sp
If the option \-\-skip\-innodb is included when connecting to a MySQL server version 5\&.7\&.5 or higher, the option is ignored and a warning is issued\&.
.sp
.if n \{\
.RS 4
.\}
.nf
\-\-mysqld="\-\-log\-bin=binlog \-\-general\-log\-file=\*(Aqmy log file\*(Aq"
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-new\-data=\fIpath_to_new_datadir\fR
.sp
The full path to the location of the data directory for the new instance\&. The path size must be 200 characters or less and it requires at least 120 MB of free space\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-new\-id=\fIserver_id\fR
.sp
The
server_id
value for the new server instance\&. The default is 2\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-new\-port=\fIport\fR
.sp
The port number for the new server instance\&. The default is 3307\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-quiet, \-q
.sp
Turn off all messages for quiet execution\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-root\-password=\fIpassword\fR
.sp
The password for the
root
user of the new server instance\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-server=\fIsource\fR
.sp
Connection information for the server to be cloned\&.
.sp
To connect to a server, it is necessary to specify connection parameters such as the user name, host name, password, and either a port or socket\&. MySQL Utilities provides a number of ways to supply this information\&. All of the methods require specifying your choice via a command\-line option such as \-\-server, \-\-master, \-\-slave, etc\&. The methods include the following in order of most secure to least secure\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Use login\-paths from your
\&.mylogin\&.cnf
file (encrypted, not visible)\&. Example :
\fIlogin\-path\fR[:\fIport\fR][:\fIsocket\fR]
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Use a configuration file (unencrypted, not visible) Note: available in release\-1\&.5\&.0\&. Example :
\fIconfiguration\-file\-path\fR[:\fIsection\fR]
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Specify the data on the command\-line (unencrypted, visible)\&. Example :
\fIuser\fR[:\fIpasswd\fR]@\fIhost\fR[:\fIport\fR][:\fIsocket\fR]
.RE
.sp
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ssl\-ca
.sp
The path to a file that contains a list of trusted SSL CAs\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ssl\-cert
.sp
The name of the SSL certificate file to use for establishing a secure connection\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ssl\-key
.sp
The name of the SSL key file to use for establishing a secure connection\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ssl
.sp
Specifies if the server connection requires use of SSL\&. If an encrypted connection cannot be established, the connection attempt fails\&. Default setting is 0 (SSL not required)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-start\-timeout=\fItimeout_in_seconds\fR
.sp
Number of seconds to wait for server to start\&. Default = 10 seconds\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-verbose, \-v
.sp
Specify how much information to display\&. Use this option multiple times to increase the amount of information\&. For example,
\fB\-v\fR
= verbose,
\fB\-vv\fR
= more verbose,
\fB\-vvv\fR
= debug\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-version
.sp
Display version information and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-write\-command=\fIfile_name\fR, \-w\fIfile_name\fR
.sp
Path name of file in which to write the command used to launch the new server instance\&.
.RE
EXAMPLES.PP
The following command demonstrates how to create a new instance of a running server, set the
root
user password and enable binary logging:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmkdir /source/test123\fR
shell> \fBmysqlserverclone \-\-server=root:pass@localhost \e\fR
    \fB\-\-new\-data=/Users/cbell/source/test123 \-\-new\-port=3310 \e\fR
    \fB\-\-root\-password=pass \-\-mysqld=\-\-log\-bin=mysql\-bin\fR
# Cloning the MySQL server running on localhost\&.
# Creating new data directory\&.\&.\&.
# Configuring new instance\&.\&.\&.
# Locating mysql tools\&.\&.\&.
# Setting up empty database and mysql tables\&.\&.\&.
# Starting new instance of the server\&.\&.\&.
# Testing connection to new instance\&.\&.\&.
# Success!
# Setting the root password\&.\&.\&.
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.sp
NOTES.PP
Should the server fail to start due to an error in the server startup sequence, the utility presents an error message along with suggestions for how to identify the error\&. The best way to find the error is to run the utility again with verbosity turned on (using the \-vvv option)\&. This displays all of the messages from the server setup\&. Examine this list to find the exact error/reason why the server did not start\&.
PERMISSIONS REQUIRED.PP
The user must have permission to read all databases\&. Since we are using the root account for these examples (and you typically would), permissions are not generally a problem\&.
.PP
You also need permissions to create the new data directory and write data to it\&.
.SH "COPYRIGHT"
.br
.PP
Copyright \(co 2006, 2017, Oracle and/or its affiliates. All rights reserved.
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
.sp
.SH "SEE ALSO"
For more information, please refer to the MySQL Utilities and Fabric
documentation, which is available online at
http://dev.mysql.com/doc/index-utils-fabric.html
.SH AUTHOR
Oracle Corporation (http://dev.mysql.com/).
